import request from "../utils/request";
// 导出一个名为checkLogin的函数，该函数接收一个参数data

export const checkLogin =(data)=> {
    // 使用request.post方法发送一个POST请求，请求的URL为"/users/checkLogin"，请求的数据为data
    return request.post("/users/checkLogin",data)
}
// 导出一个函数，用于获取订单列表
export const getOrderList = () => {
    // 发送GET请求，获取订单总数据
    return request.get("/order/totaldata")
}
// 导出一个函数getAccountList，用于获取账户列表
export const getAccountInfo = (params) => {
    // 使用request.get方法，发送GET请求，请求地址为"/users/accountinfo"，参数为params
    return request.get("/users/accountinfo",{params})
}

export const getAccountList = (params) => {
    return request.get("users/list",{params})
}
export const editAccount = (data) => {
    return request.post("/users/edit",data)
}
export const deleteAccount = (id) => {
    return request.get("/users/del", { params: { id } });
};
export const addAccount = (data) => {
    return request.post("/users/add",data)
}
export const imgupload= (data) => {
    return request.post("/users/avatar_upload",data)
}
export const avataredit= (data) => {
    return request.post("/users/avataredit",data)
}
export const editpwd = (data) => {
    return request.post("/users/editpwd",data)
}

export const getGoodList = (params) => {
    return request.get("/goods/list",{params})
}
export const addGoods = (data) => {
    return request.post("/goods/add",data)
}
export const delGoods = (id) => {
    return request.get("/goods/del",{params:{id}})
}
export const getcatelist = (params) => {
    return request.get("/goods/catelist",{params})
}
export const editcate = (data) => {
    return request.post("/goods/editcate",data)
}
export const delcate = (id) => {
    return request.get("/goods/delcate",{params:{id}})
}
export const addcate = (data) => {
    return request.post("/goods/addcate",data)
}
export const editGoods = (data) => {
    return request.post("/goods/edit",data)
}
export const getOrder = (params) => {
    return request.get("/order/list",{params})
}
export const editOrder = (data) => {
    return request.post("/order/edit",data)
}
export const detailOrder = (id) => {
    return request.get("/order/detail",{params:{id}})
}
export const getShopInfo = () => {
    return request.get("/shop/info")
}
export const updateShopInfo = (data) => {
    return request.post("/shop/edit",data)
}